package itheima02;

public class SubThread extends Thread {
    private ThreadLocal<String> tl;
    public SubThread(ThreadLocal<String> tl) {
        this.tl = tl;
    }

    @Override
    public void run() {
        //获取当前线程对象上绑定的值
        String str = tl.get();
        System.out.println("run...."+str);//run....null

        tl.set("abc");

        str = tl.get();
        System.out.println("run...."+str);//run...abc.
    }
}
